package books

class BookController {
	
	def scaffold = true
	def bookService
	
    def index() { 
		redirect(action: random)
	}
	
	def random = {
		def randomBook = bookService.getRandomBook()
		[aBook: randomBook]
	}
	
	def ajaxRandom = {
		def randomBook = bookService.getRandomBook()
		render (view:"bookBody", model: [aBook:randomBook])
	}
}
